<?
include_once('conn.php');
include_once('include/func.php');
include("admin_check.php") ;
if($admin[0][2]<>10 and $admin[0][2]<>9){exit('<script>alert("您没有权限"); window.history.back(-1);</script>');}
?>	
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><? echo systemname;?></title>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<link href="css/admin.css" rel="stylesheet" type="text/css" />
	<!-- jquery packed -->
	<script type="text/javascript" src="js/jquery-1.4.4.js"></script>
    <script type="text/javascript" src="js/dtree.js"></script>
	<!-- tableRowCheckboxToggle -->
	<script type="text/javascript" src="js/tableRowCheckboxToggle.js"></script>
    <script type="text/javascript"> 
    function fade() 
{ 
    //停留2秒后消失,在停留的时候,透明度为1.0什么都不做 
    $('<div id="add" class="quick-alert">操作成功</div>').insertAfter($("#example")).animate({opacity: 1.0}, 2000).fadeOut("slow",function(){ 
   //隐藏时把元素删除 
   $(this).remove(); 
}); 
} 
</script> 
<?

if($_POST[ch]==1){
	foreach ($_POST[selectid] as $value) {
		$updatedate = $db->UPDATE("UPDATE `".tablepre."stock` SET `delete`='0' WHERE (`sid`='$value')");
	}
				header("Location: $nowpage?ok");
	exit;	
	}
if($_POST[ch]==2){
	foreach ($_POST[selectid] as $value) {
		$deldate1 = $db->DELETE("DELETE FROM `".tablepre."stock` WHERE (`sid`='$value')");
		$deldate2 = $db->DELETE("DELETE FROM `".tablepre."stock_attachment` WHERE (`sid`='$value')");
	}
				header("Location: $nowpage?ok");
	exit;	
	}
?>
</head>
<body <? echo isset($_GET[ok])?'onload="fade();"':''; ?>>
<div id="wrap">
<div id="main" class="clearfix">
<div id="side">
  </div>
  <div id="head"><? include_once('admin_head.php');?></div>
  <div id="left"><?
  include_once('admin_menu.php');
  ?></div>
  <div id="right">
<div id="example"> </div>
<form id="form2" name="form2" method="post" action="">
<table border="0" cellspacing="0" cellpadding="0" class="dataTable">
  <thead>
<tr>
<th class="dataTableHeader">选择</th>
<th class="dataTableHeader">名称</th>
<th class="dataTableHeader">型号</th>

<th class="dataTableHeader">状态</th>
</tr>
</thead>
<tbody>
<?
$arr_list = $db->select("SELECT * FROM `".tablepre."stock` where `delete` = '1' order by sid desc");
for($i=0;$i<count($arr_list);$i++) {
	if($arr_list[$i][0]%2==0){$classcolor='st4_row';}else{$classcolor='even_row';}
	$status = $arr_list[$i][6]==0?'已下架':'出售中';
	$pricemodel = $arr_list[$i][5]==1?attachment($con0=1,$con1=$arr_list[$i][0],$con2=pricemodel1).'元':'独立价格 查看详情';
 echo '<tr class="'.$classcolor.'">
<td><input type="checkbox" id="checkme1" name="selectid[]" value="'.$arr_list[$i][0].'" /></td>
<td>'.$arr_list[$i][1].'</td>
<td>'.attachment($con0=1,$con1=$arr_list[$i][0],$con2=model).'</td>

<td style="white-space: nowrap">回收站</td>
</tr>
';
}
?>

</tbody>
</table>
<select name="ch">
  <option value="1">恢复</option>
  <option value="2">彻底删除</option>
</select>
<input type="submit" name="button2" id="button2" value="提交" />
</form></div>
  </div>
  </div>

<div id="footer">
<?
include_once('fooder.php');
?>
</div>
</BODY>
</HTML>
